<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<h:panelGrid id="messageUserInputPanel" columns="1" style="width:100%">
		<h:panelGrid columns="2" style="width:100%">
			<p:commandButton oncomplete="userDlg.show()" ajax="true"
				update=":dialogForm" icon="add"
				actionListener="#{userController.init}" value="Add"
				title="Add users" style="float:left"></p:commandButton>
			<p:commandButton value="Send this message to user(s)" ajax="true"
				actionListener="#{messageController.sendCurrentToUsers}"
				update=":headerForm" disabled="#{!messageModel.current.isHaveUser}"
				style="float:right"></p:commandButton>
		</h:panelGrid>
		<p:dataTable var="user" value="#{messageModel.current.users}"
			paginator="true" rows="15"
			rowsPerPageTemplate="5,7,10,15,20,30,40,50"
			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
			<f:facet name="header">List of users</f:facet>
			<p:column style="width:20px">
				<f:facet name="header">
					<p:commandButton icon="delete" ajax="true" update=":detailForm"
						style="float:right"
						actionListener="#{messageController.removeSelectedUsersFromCurrent}"></p:commandButton>
				</f:facet>
				<p:selectBooleanCheckbox value="#{user.selected}"></p:selectBooleanCheckbox>
			</p:column>
			<p:column headerText="id" sortBy="#{user.id}" filterBy="#{user.id}"
				filterMatchMode="contains">
				<h:outputText value="#{user.id}" />
			</p:column>
			<p:column headerText="First Name" sortBy="#{user.firstName}"
				filterBy="#{user.firstName}" filterMatchMode="contains">
				<h:outputText value="#{user.firstName}" />
			</p:column>
			<p:column headerText="Last Name" sortBy="#{user.lastName}"
				filterBy="#{user.lastName}" filterMatchMode="contains">
				<h:outputText value="#{user.lastName}" />
			</p:column>
			<p:column headerText="Address" sortBy="#{user.email}"
				filterBy="#{user.email}" filterMatchMode="contains">
				<h:outputText value="#{user.email}" />
			</p:column>
			<p:column headerText="Telephone" sortBy="#{user.telephone}"
				filterBy="#{user.telephone}" filterMatchMode="contains">
				<h:outputText value="#{user.telephone}" />
			</p:column>
		</p:dataTable>
	</h:panelGrid>

</ui:composition>

</html>